package com.zzg.cloud.healthupload;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.boot.actuate.health.Status;
import org.springframework.stereotype.Component;

/**
 * 自定义健康检测实现类
 */
@Component
@Slf4j
public class MyHealthIndicator implements HealthIndicator {

    @Override
    public Health health() {
        if(ActuatorController.myHealthFlag){
            log.info("自定义检测指标正常");
            return new Health.Builder(Status.UP).build();
        }else{
            log.info("自定义检测指标异常");
            return new Health.Builder(Status.DOWN).build();
        }
    }
}
